﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using BTN04.DTO;
using System.Collections.Generic;

namespace BTN04.DAO
{
    public class XuatSuDAO
    {
        public List<XuatSuDTO> DanhSach()
        {
            string sql = "SELECT * FROM XuatSu";
            SqlConnection cnn = new SqlConnection(DataProvider.ConnectionString);
            cnn.Open();
            SqlCommand comand = new SqlCommand(sql, cnn);
            SqlDataAdapter adapter = new SqlDataAdapter(comand);
            List<XuatSuDTO> lst= new List<XuatSuDTO>();
            SqlDataReader read = comand.ExecuteReader();
            while (read.Read())
            {
                XuatSuDTO xsDTo = new XuatSuDTO();
                xsDTo.MaXuatSu = Convert.ToInt32(read["MaXuatSu"]);
                xsDTo.TenXuatSu = read["TenXuatSu"].ToString();

                lst.Add(xsDTo);
            }
            return lst;
        }
    }
}
